// 混入
// 混入(mixin)提供了一种非常灵活的方式，来分发Vue组件中的可复用功能
// 一个混入对象可以包含任意组件选项(data methods mounted watch computed)


import Vue from "vue";
import {
  mapMutations,
  mapState,
  mapActions,
  mapGetters
} from "vuex";
import {
  FooterList
} from './index'
import {
  reg
} from './validate'
import {
  ShowSuccess
} from '@/api/request.js'

// 全局混入
Vue.mixin({
  data() {
    return {
      FooterList,
      // 正则库
      reg,
    }
  },
  methods: {
    gotowhere(name) {
      this.$router.push({
        name
      })
    },
    gotoback() {
      this.$router.back()
    },
    ...mapActions([]),
    ...mapMutations([
      'changeUserInfo',
    ]),
    ShowSuccess,
    ShowFailMsg(message = '错误') {
      this.$notify({
        message: message,
        color: '#ad0000',
        background: '#ffe1e1',
      });
    },
  },
  mounted() {

  },
  computed: {
    ...mapState([
      'userInfo',
    ])
  },
})
